package org.xjc.vo;


import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author : XJC
 * @Description :
 * @create : 2022/5/20 8:54
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespPageBean<T> {


    /**
     * 总条数
     */
    private Long  totalCount;

    /**
     * 每页记录数
     */
    private int pageSize;

    /**
     * 总页数
     */
    private int totalPage;

    /**
     * 当前页数
     */
    private int currPage;

    /**
     * 数据
     */
    private List<T> data;

    /**
     * 分页
     */
    public RespPageBean(IPage<T> page) {
        this.data = page.getRecords();
        this.totalCount = page.getTotal();
        this.pageSize = (int)page.getSize();
        this.currPage = (int)page.getCurrent();
        this.totalPage = (int)page.getPages();
    }

}
